<template>
    <div>
        <div class="flexcolumn aligncenter">
            <div class="columnitem">
                <span class="itemtitle">支付方式名称：</span>
                <span class="itemval overflowtext" v-if="form.pay_type">{{form.pay_type==1?'支付宝支付':'微信支付'}}</span>
                <span class="itemval overflowtext" v-else>-</span>
            </div>
            <div class="columnitem">
                <span class="itemtitle">用户名：</span>
                <span class="itemval overflowtext">{{form.name||'-'}}</span>
            </div>
            <div class="columnitem">
                <span class="itemtitle">性别：</span>
                <span class="itemval" v-if="form.sex==1">男</span>
                <span class="itemval" v-else-if="form.sex==2">女</span>
                <span class="itemval" v-else>-</span>
            </div>
            <div class="columnitem">
                <span class="itemtitle">联系方式：</span>
                <span class="itemval">{{form.phone||'-'}}</span>
            </div>
            <!-- <div class="columnitem">
                <span class="itemtitle">总完成单量：</span>
                <span class="itemval">{{count.total||0}}</span>
            </div> -->
            <div class="columnitem">
                <span class="itemtitle">可提现金额：</span>
                <span class="itemval">{{count.pay||0}}元</span>
            </div>
        </div>
        <div class="dialog-userfooter mt_20" style="justify-content:center">
            <el-button type="primary" v-if="count.pay&&count.pay!=0" :loading='loading' @click="handleSave">确 定</el-button>
            <el-button v-else >金额不足，暂时不能提现</el-button>
        </div>
    </div>
</template>
<script>
import { mapState } from 'vuex'
import { withDrawal } from '@/api/resource';
export default {
    data(){
        return {
            form:{
                pay_type:'',
                name:'',
                sex:'',
                phone:'',
                piao:0
            },
            loading:false
        }
    },

    created(){
        this.form.pay_type = this.user.pay_type;
        this.form.name = this.user.name;
        this.form.sex = this.user.sex;
        this.form.account = this.user.account;
        this.form.phone = this.user.phone;
    },

    props:{
        count:{
            default:{}
        }
    },

    computed: {
        ...mapState({
            user: state => state.user.user,
        }),
    },
    methods:{

        handleSave(){
            this.loading = true;
            withDrawal().then(res=>{
                this.loading = false;
                if(res.code == 1){
                    this.$message.success('提现成功');
                    this.handleCancle(1)
                }
            }).catch(e=>{
                this.loading = false;
            })
        },

        handleCancle(type){
            this.$emit('close',type)
        },
    }
}
</script>
<style lang="scss" scoped>
.columnitem{
    display: flex;
    width: 100%;
    margin-bottom: 25px;
    .itemtitle{
        display: inline-block;
        width: 50%;
        text-align: right;
        font-size: 14px;
        font-weight: 700;
        // color: #606266;
    }
    .itemval{
        display: inline-block;
        width: 50%;
        font-weight: 700;
        // color: #000;
        font-size: 14px;
    }
}
</style>